package com.woniuxy.third.service.impl;

import com.woniuxy.third.entity.*;
import com.woniuxy.third.mapper.UserMapper;
import com.woniuxy.third.result.ResponseResult;
import com.woniuxy.third.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

/**
 * @Author: yangtao
 * @date 2021/7/14 15:09
 * @Version 1.0
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User findByAccount(String account) {
        User user=userMapper.findByAccount(account);
        return user;
    }

    @Override
    public User findById(int id) {
        return userMapper.findById(id);
    }

    @Override
    public int updateBalance(int id,BigDecimal subtract) {

        return userMapper.updateBalance(id,subtract);
    }

    @Override
    public boolean updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public boolean delMyCourseByUidCid(int uid, int cid) {
        return userMapper.delMyCourseByUidCid(uid,cid);
    }

    @Override
    public boolean addMyCourseByUidCid(int uid, int cid) {
        return userMapper.addMyCourseByUidCid(uid,cid);
    }

    @Override
    public boolean delMyCollectionByUidCid(int uid, int cid) {
        return userMapper.delMyCollectionByUidCid(uid,cid);
    }

    @Override
    public boolean addMyCollectionByUidCid(int uid, int cid) {
        return userMapper.addMyCollectionByUidCid(uid,cid);
    }

    @Override
    public List<UserCollection> findMyCollectionByUid(int uid) {
        return userMapper.findMyCollectionByUid(uid);
    }

    @Override
    public List<UserCourse> findMyCourseByUid(int uid) {
        return userMapper.findMyCourseByUid(uid);
    }

}











